<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<title></title>
	<style type="text/css">
		*{
			margin: 0;
			padding: 0;
		}
		ul{
			list-style: none;
			display: flex;
			flex-wrap: wrap;
		}
		li{
			width: 120px;
			display: flex;
			flex-direction: column;
			justify-content: center;
			align-items: center;
			margin: 10px;
		}
		.box{
			width: 800px;
			margin: 0 auto;
		}
		img{
			width: 100%;

		}
	</style>
</head>
<body>
	<div class="box">
		<ul>
		   <!-- <li>
					<img src="">
					<span></span>
		   </li> -->

		</ul>
	</div>
	<script type="text/javascript" src="./ajax.js"></script>
	<script type="text/javascript">
		let ul = document.querySelector("ul")
		// 接口
			ajax({
				method:"get",
				url: "https://game.gtimg.cn/images/lol/act/img/js/heroList/hero_list.js",
				params:{
					 v: 58
				},
				success: function(res){
					console.log(res)
					// 遍历数组
					for(let i = 0; i < res.hero.length; i++ ){
						console.log(res.hero[i])
						let id = res.hero[i].heroId
						console.log(id)
						ul.innerHTML += `<li 
						onclick="jump(${res.hero[i].heroId}) ">
						<img src="https://game.gtimg.cn/images/lol/act/img/champion/${res.hero[i].alias}.png">
						<span>${res.hero[i].name}</span>
						</li>`
					}
				}
			})
		function  jump(id){
			// 跳转
			location.href=`./lol2.html?id=${id}`
		}
	</script>
</body>
</html>